package yang.yu.sunny.domain;

import org.dayatang.domain.AbstractEntity;

import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;

/**
 * 产品类别关系,记录产品类别的父子关系
 * Created by yyang on 16/3/15.
 */
@Entity
@Table(name = "product_category_rel")
class ProductCategoryRelation extends AbstractEntity {

    @ManyToOne
    private ProductCategory parent;

    @ManyToOne
    private ProductCategory child;

    protected ProductCategoryRelation() {
    }

    public ProductCategoryRelation(ProductCategory parent, ProductCategory child) {
        this.parent = parent;
        this.child = child;
    }

    public ProductCategory getParent() {
        return parent;
    }

    public ProductCategory getChild() {
        return child;
    }
}
